<template>
  <el-card class="card-panel" :class="{ 'no-padding': noPadding }">
    <template #header v-if="title || $slots.header">
      <div class="card-header">
        <div class="header-title">
          <slot name="icon">
            <i v-if="icon" :class="icon" class="card-icon"></i>
          </slot>
          <span>{{ title }}</span>
        </div>
        <div class="header-actions">
          <slot name="actions"></slot>
        </div>
      </div>
    </template>
    <div class="card-body">
      <slot></slot>
    </div>
  </el-card>
</template>

<script setup>
defineProps({
  title: {
    type: String,
    default: ''
  },
  icon: {
    type: String,
    default: ''
  },
  noPadding: {
    type: Boolean,
    default: false
  }
})
</script>

<style scoped>
.card-panel {
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08) !important;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-title {
  display: flex;
  align-items: center;
  font-weight: bold;
  font-size: 15px;
}

.card-icon {
  margin-right: 8px;
}

.header-actions {
  display: flex;
  align-items: center;
}

.card-body {
  width: 100%;
}

.no-padding :deep(.el-card__body) {
  padding: 0;
}
</style> 